package qianfeng.com.meijiadaka.viewholder;

import android.graphics.Color;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;

import cn.lemon.view.adapter.BaseViewHolder;
import qianfeng.com.meijiadaka.R;
import qianfeng.com.meijiadaka.adapter.DuoAdapter;
import qianfeng.com.meijiadaka.bean.TypeBean;
import qianfeng.com.meijiadaka.myview.RecycleViewDivider;

/**
 * Created by yanshihao on 2017/2/8.
 */

public class DuoImageViewHolder extends BaseViewHolder<TypeBean> {
    private RecyclerView mRecyclerView;
    public DuoImageViewHolder(ViewGroup parent) {
        super(parent, R.layout.home_adapter);
    }

    @Override
    public void onInitializeView() {
        super.onInitializeView();
        mRecyclerView=findViewById(R.id.home_adapter_rv);
    }

    @Override
    public void setData(TypeBean object) {
        super.setData(object);
        GridLayoutManager manager = new GridLayoutManager(itemView.getContext(), 2);
        manager.setOrientation(LinearLayoutManager.VERTICAL);
        mRecyclerView.setLayoutManager(manager);
       mRecyclerView.setAdapter(new DuoAdapter(itemView.getContext(), object.getPicturesBeen()));
        mRecyclerView.addItemDecoration(new RecycleViewDivider(itemView.getContext(), LinearLayoutManager.VERTICAL, 5, Color.WHITE));
        mRecyclerView.addItemDecoration(new RecycleViewDivider(itemView.getContext(), LinearLayoutManager.HORIZONTAL, 5, Color.WHITE));
    }

    @Override
    public void onItemViewClick(TypeBean object) {
        super.onItemViewClick(object);
    }
}
